﻿@{
    ViewBag.Title = "输入患者社保卡号";
    Layout = "~/Views/Shared/_Form.cshtml";
    var from = (ViewBag.from as string) ?? "";
    //医保所属地
    var medicalInsurance = SysConfigReader.String("Outpatient_MedicalInsurance");
}
<style>
    .formTitle span {
        color: red;
    }
    .table-responsive {
        border: 0;
    }

    .ui-jqgrid .ui-jqgrid-pager .ui-pager-table {
        width: 90%;
    }
</style>

<form id="formPatsbkh" style="margin:2px;margin-top:10px;">
    <div class="gridPanel">
        <table id="patSbkh" rel="formPatSer">
            <tr>
                <td class="formTitle">
                    <span>*</span>卡号：
                </td>
                <td class="formValue" style="text-align:left">
                    <input type="text" id="sbkhId" class="form-control form-an"  autocomplete="off" style="height:15px">
                </td>
            </tr>

        </table>
    </div>
</form>

<script>
    var topform = $.request('topform');
    var medicalInsurance = '@medicalInsurance';//医保所属地配置:区分医院所属医保区域
    //var medicalInsurance = $.request("medicalInsurance");
    $(function () {
        $('#sbkhId').focus();
    });
    $("#formPatsbkh").bind("keydown", function (e) {
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            PatSbkhData();
        }
    });
    var prevWindow;
   if ('@(from)' !== '') {
        prevWindow = top.top.frames['@(from)'];
    }
    else {
        prevWindow = $.currentWindow();
    }
    if (topform=="1") {
        prevWindow =top.frames['dqfsxz'];
    }
    //jqGrid 双击选中某行
    function btn_edit() {
        PatSearchConfirm();
    }

    function PatSbkhData()
    {
         //上一个window对象
        var sbkhVal = $("#sbkhId").val();
        //alert(sbkhVal);
        //return;
        if (!(sbkhVal)) {
            $.modalAlert("请填写社保卡号", 'warning');
            return;
        }
        debugger;
        var sbkobj = new Object();
        sbkobj.sbkh = sbkhVal;
        if (medicalInsurance == "shanghai") {
            prevWindow.readCard(sbkobj);
        } else {
            prevWindow.GetReadCardInfo(sbkobj);
        }
        //关闭窗口
        ReceiptCancle();
    }

    //确定 主页面调用
    function PatSearchConfirm() {
        PatSbkhData();
    }

    //取消
    function ReceiptCancle() {
            $.modalClose();
    }
</script>